<?php
/**
 * Depends on jfRedirectByUserAgentPlugin (http://code.google.com/p/jfredirectbyuseragentplugin/)
 * 
 * Does not redirect if the requested page is already enhanced by jfPortableDevicePlugin
 * 
 * Example filters.yml integration:
 * 
 * <pre>
jfPortableDeviceRedirectByUserAgent:
  class:  jfPortableDeviceRedirectByUserAgentFilter
  param:
    redirectUrl: '/portableRedirect'
    redirectUrlGetParameters:
      redirectUrl: %s #%s gets replaced by the requested url
    #redirectUrlJavascriptCallback: "url+='&jfPD_size='+(window.innerWidth > 800 || window.innerHeight > 800 ? '3' : '2');"   
    noHeaderRedirect: true
    javascriptConfirm: true
    stopParameters:
      - noMobileRedirect
    stopModules:
      - jfPortableDevice
    userAgentWhitelist: #list of regular expressions
      - AppleWebKit.*Mobile
      - SymbianOS.*AppleWebKit
      - Android.*Firefox/4
      - Opera/9.*Opera Mobi
      - Opera/10.*Opera Mobi     
      - Opera/11.*Opera Mobi   
      - MSIE 9.*Windows Phone
      - MSIE 9.*WP7
#    userAgentBlacklist: #list of regular expressions
#      - iPad
 *
 */
class jfPortableDeviceRedirectByUserAgentFilter extends jfRedirectByUserAgentFilter
{
  public function execute($filterChain)
  {
    if (jfPortableDevice::isPortableDevice()) {
    	self::disable();
    }
		return parent::execute($filterChain);
  }

}
